package com.amox.uitest.adapter;

import org.dom4j.Element;
import org.dom4j.Node;

import com.amox.uitest.common.KeyWord;
import com.amox.uitest.kit.LogKit;
import com.amox.uitest.tcase.BaseTestCase;

public class ClassAdapter extends BaseAdapter<Boolean> {
	
	private LauchAdapter lauchAdapter;
	
	public ClassAdapter(BaseTestCase uitest) {
		super(uitest);
		lauchAdapter = new LauchAdapter(uitest);
	}
	
	@Override
	public Boolean adapter(Element element) throws Exception {
		String id = element.attributeValue(KeyWord.id.name());
		LogKit.printLog("Starting Class : " + id);
		
		Node lauch = element.selectSingleNode(KeyWord.lauch.name());
		
//		Node lauch = XMLKit.me(uitest).byAttr(element, KeyWord.lauch, KeyWord.id, KeyWord.dev);
		boolean rt = lauchAdapter.adapter((Element)lauch);
		
		LogKit.printLog("Finished Class : {0} = {1}", id, rt);
		
		return rt;
	}
}
